

package com.hazelcast.jet.retry.impl;

import com.hazelcast.jet.retry.IntervalFunction;
import com.hazelcast.jet.retry.RetryStrategy;

import java.io.Serial;

public class RetryStrategyImpl implements RetryStrategy {

    @Serial
    private static final long serialVersionUID = 1L;

    private final int maxAttempts;
    private final IntervalFunction intervalFunction;

    public RetryStrategyImpl(int maxAttempts, IntervalFunction intervalFunction) {
        this.maxAttempts = maxAttempts;
        this.intervalFunction = intervalFunction;
    }

    @Override
    public int getMaxAttempts() {
        return maxAttempts;
    }

    @Override
    public IntervalFunction getIntervalFunction() {
        return intervalFunction;
    }

    @Override
    public String toString() {
        return "max attempts = " + maxAttempts + ", interval function = " + intervalFunction;
    }
}
